//
// CPatchDLMContext.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;

public class CPatchDLMContext {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CPatchDLMContext(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CPatchDLMContext obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CPatchDLMContext(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setTextPosX(long value) {
    nel3dJNI.CPatchDLMContext_TextPosX_set(swigCPtr, this, value);
  }

  public long getTextPosX() {
    return nel3dJNI.CPatchDLMContext_TextPosX_get(swigCPtr, this);
  }

  public void setTextPosY(long value) {
    nel3dJNI.CPatchDLMContext_TextPosY_set(swigCPtr, this, value);
  }

  public long getTextPosY() {
    return nel3dJNI.CPatchDLMContext_TextPosY_get(swigCPtr, this);
  }

  public void setWidth(long value) {
    nel3dJNI.CPatchDLMContext_Width_set(swigCPtr, this, value);
  }

  public long getWidth() {
    return nel3dJNI.CPatchDLMContext_Width_get(swigCPtr, this);
  }

  public void setHeight(long value) {
    nel3dJNI.CPatchDLMContext_Height_set(swigCPtr, this, value);
  }

  public long getHeight() {
    return nel3dJNI.CPatchDLMContext_Height_get(swigCPtr, this);
  }

  public void setDLMUScale(float value) {
    nel3dJNI.CPatchDLMContext_DLMUScale_set(swigCPtr, this, value);
  }

  public float getDLMUScale() {
    return nel3dJNI.CPatchDLMContext_DLMUScale_get(swigCPtr, this);
  }

  public void setDLMVScale(float value) {
    nel3dJNI.CPatchDLMContext_DLMVScale_set(swigCPtr, this, value);
  }

  public float getDLMVScale() {
    return nel3dJNI.CPatchDLMContext_DLMVScale_get(swigCPtr, this);
  }

  public void setDLMUBias(float value) {
    nel3dJNI.CPatchDLMContext_DLMUBias_set(swigCPtr, this, value);
  }

  public float getDLMUBias() {
    return nel3dJNI.CPatchDLMContext_DLMUBias_get(swigCPtr, this);
  }

  public void setDLMVBias(float value) {
    nel3dJNI.CPatchDLMContext_DLMVBias_set(swigCPtr, this, value);
  }

  public float getDLMVBias() {
    return nel3dJNI.CPatchDLMContext_DLMVBias_get(swigCPtr, this);
  }

  public void setMinU8(short value) {
    nel3dJNI.CPatchDLMContext_MinU8_set(swigCPtr, this, value);
  }

  public short getMinU8() {
    return nel3dJNI.CPatchDLMContext_MinU8_get(swigCPtr, this);
  }

  public void setMaxU8(short value) {
    nel3dJNI.CPatchDLMContext_MaxU8_set(swigCPtr, this, value);
  }

  public short getMaxU8() {
    return nel3dJNI.CPatchDLMContext_MaxU8_get(swigCPtr, this);
  }

  public void setMinV8(short value) {
    nel3dJNI.CPatchDLMContext_MinV8_set(swigCPtr, this, value);
  }

  public short getMinV8() {
    return nel3dJNI.CPatchDLMContext_MinV8_get(swigCPtr, this);
  }

  public void setMaxV8(short value) {
    nel3dJNI.CPatchDLMContext_MaxV8_set(swigCPtr, this, value);
  }

  public short getMaxV8() {
    return nel3dJNI.CPatchDLMContext_MaxV8_get(swigCPtr, this);
  }

  public void setOldPointLightCount(long value) {
    nel3dJNI.CPatchDLMContext_OldPointLightCount_set(swigCPtr, this, value);
  }

  public long getOldPointLightCount() {
    return nel3dJNI.CPatchDLMContext_OldPointLightCount_get(swigCPtr, this);
  }

  public void setCurPointLightCount(long value) {
    nel3dJNI.CPatchDLMContext_CurPointLightCount_set(swigCPtr, this, value);
  }

  public long getCurPointLightCount() {
    return nel3dJNI.CPatchDLMContext_CurPointLightCount_get(swigCPtr, this);
  }

  public CPatchDLMContext() {
    this(nel3dJNI.new_CPatchDLMContext(), true);
  }

  public boolean generate(CPatch patch, CTextureDLM textureDLM, CPatchDLMContextList ctxList) {
    return nel3dJNI.CPatchDLMContext_generate(swigCPtr, this, CPatch.getCPtr(patch), patch, CTextureDLM.getCPtr(textureDLM), textureDLM, CPatchDLMContextList.getCPtr(ctxList), ctxList);
  }

  public void clearLighting() {
    nel3dJNI.CPatchDLMContext_clearLighting(swigCPtr, this);
  }

  public void addPointLightInfluence(CPatchDLMPointLight pl) {
    nel3dJNI.CPatchDLMContext_addPointLightInfluence(swigCPtr, this, CPatchDLMPointLight.getCPtr(pl), pl);
  }

  public void compileLighting(CPatchDLMContext.TCompileType compType, CRGBA modulateCte) {
    nel3dJNI.CPatchDLMContext_compileLighting__SWIG_0(swigCPtr, this, compType.swigValue(), CRGBA.getCPtr(modulateCte), modulateCte);
  }

  public void compileLighting(CPatchDLMContext.TCompileType compType) {
    nel3dJNI.CPatchDLMContext_compileLighting__SWIG_1(swigCPtr, this, compType.swigValue());
  }

  public CPatch getPatch() {
    long cPtr = nel3dJNI.CPatchDLMContext_getPatch(swigCPtr, this);
    return (cPtr == 0) ? null : new CPatch(cPtr, false);
  }

  public long getMemorySize() {
    return nel3dJNI.CPatchDLMContext_getMemorySize(swigCPtr, this);
  }

  public final static class TCompileType {
    public final static TCompileType ModulateTileColor = new TCompileType("ModulateTileColor", nel3dJNI.CPatchDLMContext_ModulateTileColor_get());
    public final static TCompileType ModulateTextureFar = new TCompileType("ModulateTextureFar");
    public final static TCompileType ModulateConstant = new TCompileType("ModulateConstant");
    public final static TCompileType NoModulate = new TCompileType("NoModulate");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TCompileType swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TCompileType.class + " with value " + swigValue);
    }

    private TCompileType(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TCompileType(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TCompileType(String swigName, TCompileType swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TCompileType[] swigValues = { ModulateTileColor, ModulateTextureFar, ModulateConstant, NoModulate };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
